package com.yqg.protection.listenern;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.yqg.protection.controller.dto.ImportFireManageInforDto;
import com.yqg.protection.entity.FireManageInfor;
import com.yqg.protection.mapper.FireManageInforMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * projectName:xf-service1
 * author:zxf
 * time:2024/10/16 15:20
 * description:
 */
@Component
public class FireManageInforListener extends AnalysisEventListener<ImportFireManageInforDto> {

    @Autowired
    private FireManageInforMapper fireManageInforMapper;

    @Override
    public void invoke(ImportFireManageInforDto importFireManageInforDto, AnalysisContext analysisContext) {
        FireManageInfor fireManageInfor = new FireManageInfor();
        BeanUtil.copyProperties(importFireManageInforDto, fireManageInfor, true);
        fireManageInfor.setIsDelete(0);
        fireManageInforMapper.insert(fireManageInfor);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
